/**
 * Created by 30947 on 2018/7/20.
 */
$(function(){
    getHt();
    // table();
    djxx();
})



// 获取div的高度
function getHt(){
   var all_height=$(window).height();
   var div_height=all_height-80;
    $("#car_control").css("height",div_height+"px");


}
// 表格部分
function nsrcx(){
    $('#nsrcxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/nsrcx",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            },

            {
                title: '操作',
                field: 'opear',
                width:'250px',
                align: 'center',
                formatter: function (value, row) {
                    var e = '<a  href="javascript:void(0)" class="table_edit" title="咨询" onclick="edit(\'' + row.id + '\')">编辑</a> ';
                    var c = '<a   href="javascript:void(0)" class="table_del" title="删除" onclick="del(\'' + row.id + '\')">删除</a> ';


                    return e+c ;
                }
            }
        ]
    });
}

function djxx(){
    $('#djxxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/djxx",
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/json; charset=UTF-8",
        queryParams:function queryParams(params) {  //设置查询参数page和rows
            //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var param={
            		page : params.offset, //首页页码
            		limit : params.limit    //每页的记录行数
            };
            return JSON.stringify(param);
        },
        sidePagination: "server", //服务端请求
        responseHandler:responseHandler,//请求数据成功后，渲染表格前的方法
        columns: [
            /*{
                title: "登记序号",
                field: 'djxh',
                align: 'center',
                valign: 'middle'
            },*/
            {
                title: "社会信用代码",
                field: 'shxydm',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "纳税人识别号",
                field: 'nsrsbh',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "纳税人名称",
                field: 'nsrmc',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "纳税人状态",
                field: 'nsrztmc',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "行业种类名称",
                field: 'hyzlmc',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "行业名称",
                field: 'hymc',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "登记注册类型名称",
                field: 'djzclxmc',
                align: 'center',
                valign: 'middle'
            },
            {
                title: "县区局税务机关",
                field: 'qxjswjg_dm',
                align: 'center',
                valign: 'middle'
            },
            
            {
                title: "市局税务机关",
                field: 'dsjswjgmc',
                align: 'center',
                valign: 'middle'
            },
        ]
    });
}


function sbxxYbr(){
    $('#sbxxYbrTable').bootstrapTable({
        method: "post",
        url: "/visual/table/sbxxYbr",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }
            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}


function sbxxXgm(){
    $('#sbxxXgmTable').bootstrapTable({
        method: "post",
        url: "/visual/table/sbxxXgm",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }
            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}



function rkxx(){
    $('#rkxxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/rkxx",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}


function fpxxJx(){
    $('#fpxxJxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/fpxxJx",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}


function fpxxXx(){
    $('#fpxxJxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/fpxxXx",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}

function cljl(){
    $('#cljlTable').bootstrapTable({
        method: "post",
        url: "/visual/table/json/case.json",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}


function yjxx(){
    $('#yjxxTable').bootstrapTable({
        method: "post",
        url: "/visual/table/json/case.json",
        striped: true,
        singleSelect: false,
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        //sidePagination: "server", //服务端请求
        columns: [
            {
                title: "",
                field: 'ch',
                align: 'center',
                width:'30px',
                valign: 'middle',
                formatter:function(val,row){

                    return '<div class="cliclRed"></div>';
                }

            }
            ,
            {
                title: "事项名称",
                field: 'name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '负责部门',
                field: 'part',
                align: 'center',
                valign: 'middle'
            }
        ]
    });
}





function add(){

     layer.open({
         type: 2,
         skin: 'demo-class',

         title: '详情页面',
         fix: true,
         shadeClose: true,

         area: ['1000px', '500px'],
         content: 'tail_sm.html',

     });
     
 }
function edit(){

    layer.open({
        type: 2,
        skin: 'layui-layer-lan',

        title: '详情页面',
        fix: true,
        shadeClose: true,

        area: ['1100px', '600px'],
        content: 'tail_more.html',

    });
    //加载层-默认风格
    //layer.load(1);
//此处演示关闭
//     setTimeout(function(){
//         layer.closeAll('loading');
//     }, 2000);
}
function openList(){
    $(".find_expend").show();
    $("#open").hide();
}
function closeList(){
    $(".find_expend").hide();
    $("#open").show();
}



//请求成功方法
function responseHandler(result){
    var errcode = result.code;//在此做了错误代码的判断
    if(errcode != 0){
        // alert("错误代码" + errcode);
        return;
    }
    
    //如果没有错误则返回数据，渲染表格
    
    return {
        total : result.data.pages, //总页数,前面的key必须为"total"
        rows : result.data.records //行数据，前面的key要与之前设置的dataField的值一致.
    };
};
